import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import vitePluginVuedoc from "vite-plugin-vuedoc";
import { vitePluginVuedocConfig, vueConfig } from "./config/plugins";

// https://vitejs.dev/config/
export default defineConfig({
  base: "/",
  plugins: [vitePluginVuedoc(vitePluginVuedocConfig), vue(vueConfig)],
  server: {
    port: 9527
  },
  resolve: {
    alias: {
      "@": resolve(__dirname, "./example"),
      "~": resolve(__dirname, "./packages"),
      "^": resolve(__dirname, "./site")
    }
  },
  css: {
    preprocessorOptions: {
      less: {
        additionalData: `@import "@/styles/variables.less";`
      }
    }
  },
  build: {
    rollupOptions: {
      input: {
        main: resolve(__dirname, "./index.html"),
        site: resolve(__dirname, "./site.html")
      }
    }
  }
});
